package cn.zbmao.web.config;

import com.jfinal.handler.Handler;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class ContextPathHandler extends Handler {
    /**
     * 为页面传递thispath属性，该属性存放ip,端口，应用名
     * @param target
     * @param request
     * @param response
     * @param isHandled
     */
	public void handle(String target, HttpServletRequest request, HttpServletResponse response, boolean[] isHandled) {
		request.setAttribute("thispath", request.getScheme() + "://"
		        + request.getServerName() + ":" + request.getServerPort()
		        + request.getContextPath() + "/");
		nextHandler.handle(target, request, response, isHandled);
	}
}
